package com.example.sqlitetest;

import androidx.appcompat.app.AppCompatActivity;
import androidx.room.Room;

import android.os.Bundle;
import android.util.Log;

import java.util.List;

public class MainActivity extends AppCompatActivity {

    WordDao wordDao;
    WordDatabase wordDatabase;

    AlarmDataDao alarmDataDao;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        wordDatabase = Room.databaseBuilder(this,WordDatabase.class,"word_database")
                .allowMainThreadQueries()
                .build();
        wordDao = wordDatabase.getWordDao();
        alarmDataDao = wordDatabase.getAlarmDataDao();

        Word word1 = new Word("谷子腾","恶霸");
        Word word2 = new Word("张凯鑫","胖鑫");
        Word word3 = new Word("王正帅","笑天");
        wordDao.insertWord(word1,word2,word3);
        List<Word> list = wordDao.getAllWords();
        Log.d("test123", "onCreate: "+list.get(0).getTimeStart());


        AlarmData alarmData = new AlarmData(12,1);
        alarmDataDao.insertAlarmData(alarmData);
    }
}